package cn.it.hbtt.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class BaseDAO {


    public Connection getConnection() {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            String url = "jdbc:mysql://localhost:3306/myschool?serverTimezone=UTC&enconding=UTF-8&usessl=flase";
            String user = "root";
            String password = "1234";
            Connection conn = DriverManager.getConnection(url, user, password);
            return conn;

        } catch (ClassNotFoundException | SQLException e) {
            e.printStackTrace();

            return null;
        }
    }
  

    /*public static void main(String[] args) {

        System.out.println(new BaseDAO().getConnection());
    }*/
}
